/**
 *    Copyright (C) 2008, 2009  Victor Smirnov <aist11@gmail.com>
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *    See LICENSE.exceptions in the root folder of this project for possible
 *    exceptions
 *
 */

#ifndef _CUBEFS_API_REFLECTION_OPERATION_HPP
#define	_CUBEFS_API_REFLECTION_OPERATION_HPP

#include <cubefs/api/reflection/type.hpp>
#include <cubefs/api/reflection/list.hpp>
#include <cubefs/api/macro.hpp>

#include <vector>

#define CUBEFS_SOURCE "operation.hpp:" CUBEFS_AT

namespace cubefs    {
namespace api       {

struct CUBEFS_API Argument: public Typed {

    virtual StringRef name() const 				= 0;
    virtual Type* GetParameterType() const 		= 0;
    virtual bool type_owner() const 			= 0;
    virtual Type* type() const 					= 0;

    static Type* MyType();
};

CUBEFS_DECLARE_TYPENAME(Argument, "cubefs::api::Argument");


struct CUBEFS_API Operation: public Typed {

    virtual Type* owner() const                                     			= 0;
    virtual Type* GetReturnType() const                             			= 0;
    virtual Int GetArgumentsCount() const                           			= 0;
    virtual const Argument *GetArgument(Int index) const            			= 0;
    virtual const Argument *GetArgument(const std::string &name) const 			= 0;
    virtual const std::string &name() const                         			= 0;
    virtual Typed *invoke(Typed* target, StaticListOfTyped* arguments) const 	= 0;
    virtual bool IsStatic() 													= 0;
    virtual Type* type() const  												= 0;

    static  Type* MyType();
};

CUBEFS_DECLARE_TYPENAME(Operation, "cubefs::api::Operation");

}
}

#undef CUBEFS_SOURCE

#endif
